﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApI0001.DoMain.Entity
{
    public class DbInitializeHelper
    {
        public static void Initialize()
        {
            using (var db = new Admin0001DbContext())
            {
                db.Database.EnsureCreated();

                var brand = new Brand
                { BrandName = "小米sj", 
                  Description = "国产最具性价比的手机品牌" 
                };

                db.Brands.Add(brand);

                db.SaveChanges();

                db.ProDucks.AddRange(new ProDuck[]
                    {
                        new ProDuck
                        {
                            ProduckName ="?????????",
                            ShortDesc = "?????????",
                            FullDesc = "????????",
                            BrandId =brand.Id
                        },
                        new ProDuck
                        {
                             ProduckName ="??????",
                            ShortDesc = "??????",
                            FullDesc = "?????????",
                            BrandId =brand.Id
                        }
                    });
            }
        }
    }
}
